<?php
/*
* Author: Nguyen Hai Nam
* Module: index
* Desc	: Introduce pick.vn and sidle pic
* Date	: 12/12/2011
*/
class IndexModule extends Pick_Core_Module{
	
	function IndexModule(){
		
		parent::Pick_Core_Module();
		//$this->pushJS();
		//$this->pushCSS();
		# Languages
		$languages = new Pick_Core_Languages();
		$objectLanguages = "";
		$objectLanguages = $languages->getObjects(1, 'status = 1', array('position'=>'ASC'), '');
		if($objectLanguages){
			$objectLanguages = $objectLanguages['data'];	
		}#endif
		$this->template->assign("objectLanguages", $objectLanguages);
	}
	public function getContent(){
		
		$productcategory = new Pick_Dao_ProductCategory();
		$product = new Pick_Dao_Product();
		$arrObjCategory =  $productcategory->getSubCategoryHome(0);
		$this->template->assign('arrObjCategory', $arrObjCategory);
		$this->template->assign('productcategory', $productcategory);
		$this->template->assign('product', $product);
		//Regions
		$regions = new Pick_Dao_Regions();
		$arrRegions = $regions->getObjects(1, 'status = 1', array('position'=>'DESC'));
		$this->template->assign('arrRegions', $arrRegions);
		//r&d
		$newscategory = new Pick_Dao_NewsCategory();
		$news = new Pick_Dao_News();
		$objCategoryRD = $newscategory->getObjectFromSlug('r-d');
		$objRDDefault = $news->getObjectFirstOneFromCId($objCategoryRD->getField('id'));
		$this->template->assign('objRDDefault', $objRDDefault);
		//careers
		$objCategoryCareers = $newscategory->getObjectFromSlug('careers');
		$objCareersDefault = $news->getObjectFirstOneFromCId($objCategoryCareers->getField('id'));
		$this->template->assign('objCareersDefault', $objCareersDefault);
		// environment
		$objCategoryEnvironment = $newscategory->getObjectFromSlug('environment');
		$objEnvironmentDefault = $news->getObjectFirstOneFromCId($objCategoryEnvironment->getField('id'));
		$this->template->assign('objEnvironmentDefault', $objEnvironmentDefault);
		// news-media
		$objCategoryNewsMedia = $newscategory->getObjectFromSlug('news-media');
		$objNewsMediaDefault = $newscategory->getObjectFirstOneFromCId($objCategoryNewsMedia->getField('id'),array('position'=>'DESC'));
		$this->template->assign('objNewsMediaDefault', $objNewsMediaDefault);
		
	}
}